<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('config/about')}">关于我们</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form margin-top-20" role="form" action="{:url('config/about')}"
          method="post">
          <input type="hidden" name="id" value="{$info['id']}">
        <fieldset>
            <div class="tabbable">
                <div class="tab-content">
                    <div class="tab-pane active" id="A">
                        <div class="form-group">
                            <label for="input-site-name" class="col-sm-2 control-label">公司名称</label>
                            <div class="col-md-3 col-sm-5">
                                <input type="text" class="form-control" name="name"
                                    value="{$info['name']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-site-name" class="col-sm-2 control-label">成立时间</label>
                            <div class="col-md-3 col-sm-5">
                                <input type="date" class="form-control" name="date"
                                       value="{$info['date']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-site-name" class="col-sm-2 control-label">公司地址</label>
                            <div class="col-md-3 col-sm-5">
                                <input type="text" class="form-control" name="address"
                                       value="{$info['address']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-site-name" class="col-sm-2 control-label">联系电话</label>
                            <div class="col-md-3 col-sm-5">
                                <input type="text" class="form-control" name="phone"
                                        value="{$info['phone']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-site-name" class="col-sm-2 control-label">公司历史</label>
                            <div class="col-md-3 col-sm-5">
                                <script type="text/plain" id="content" name="history">{$info['history']}</script>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-site-name" class="col-sm-2 control-label">banner</label>
                            <div class="col-md-3 col-sm-5">
                                <input id="photo-1" type="hidden" name="img">
                                <img id="photo-1-preview" style="width:250px;height:100px;" src="{$info['img']}">
                                <a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="input-site-name" class="col-sm-2 control-label">logo</label>
                            <div class="col-md-3 col-sm-5">
                                <input type="hidden" name="logo" v-model="logoimg">
                                <input type="file" style="width:100px;height:100px;opacity:0" ref="inputer" @change="addImg()" multiple accept="image/*">
                                <img :src="logo" style="width:100px;height:100px;margin-top:-100px;">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" style="width:150px;" class="btn btn-primary">
                                    确认修改
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </fieldset>
    </form>

</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script href="__STATIC__/js/Jquery/jquery.js" /></script>
<script type="text/javascript">
    window.UEDITOR_HOME_URL = "__STATIC__/js/ueditor/";    //UEDITOR_HOME_URL、config、all这三个顺序不能改变(绝对路径)
</script>
<load href="__STATIC__/js/ueditor/ueditor.config.js" /></script>
<load href="__STATIC__/js/ueditor/ueditor.all.min.js" />
<script src="__STATIC__/admin/js/vue.js"></script>
<script src="__STATIC__/admin/js/axios.min.js"></script>
<script src="__STATIC__/admin/js/ajaxfileupload.js"></script>
<script type="text/javascript">
    $(function(){
        var ueditor;
            //具体参数配置在  editor_config.js  中
        var options = {
            initialFrameWidth:700,        //初化宽度
            initialFrameHeight:300,        //初化高度
            focus:false,                        //初始化时，是否让编辑器获得焦点true或false
            maximumWords:1000,        //允许的最大字符数
        };
        ueditor = new UE.ui.Editor(options);
        ueditor.render("content");
        
    });    
    </script>
<script>
var my = new Vue({
    el: '#A',
    data: {
        logo:{$logo},
        logoimg:{$logo},
        formData:new FormData(),
    },
    methods: {

        //图片上传
        addImg(){
            if (Math.floor(this.$refs.inputer.files[0].size / 1024) > 5*1024*1024) {
                alert('图片大于5M');
                return false
            };
            this.formData.append("file", this.$refs.inputer.files[0]);
            var that = this;
            axios.post("{:url('config/upload')}",this.formData,{
                    headers: {'Content-Type': 'multipart/form-data'}
            }).then(res => {
                if(res.data.code == 200){
                    that.logo = res.data.data;
                    that.logoimg = res.data.data;
                }
                return;
            })
        },
        
        
    },
    mounted() {
    }
})

</script>
</body>
</html>
